<template>
	<view class="message-detail">
		<titleName :name="name" :backShow="true"></titleName>

		<view class="wrap">
			<view class="title">
				<view class="name">{{msgData.title}}</view>
				<view class="time1">第{{msgData.data1}}次提醒</view>
				<view class="publisher">
					<image :src="resourceUrl+'login-huanbao-bgc.png'" mode=""></image>
					<view class="content">
						<view class="name">{{msgData?.publisher}}</view>
						<view class="publish-time">
							<view class="publish">发布</view>
							<view class="time">{{msgData?.committime}}</view>
						</view>
					</view>
				</view>
			</view>

			<view class="msg">
				<!-- <view class="type" v-html="msgData.content"></view> -->
				<!-- 	<view class="type" v-if="msgData.noticetype==3">{{msgData.content}}</view>
				<view class="type" v-if="msgData.noticetype==1 || msgData.noticetype==2">污染源类别：{{msgData.data1}}</view>
				<view class="type" v-if="msgData.noticetype==1 || msgData.noticetype==2">污染物名称：{{msgData.data2}}</view>
				<view class="type" v-if="msgData.noticetype==5">{{msgData.content}}</view>
			 -->

				<view class="type">{{disposeContent(msgData.content).clearEnd}}</view>
				<button class="detail" v-if="msgData.noticetype==3" @click="jumpGuide()">
					(参考办理指南)
				</button>
				<button class="detail" v-if="msgData.noticetype==2"
					@click="jumpOnlineMonitorContent(msgData.subnoticetype)">
					(参照以下要求)
				</button>
				<view class="status-wrap" v-if="msgData.noticetype==4">

					<button class="down" @click="jumpRectification(msgData.followflag,msgData.status)"
						v-if="msgData.status==3">整改完成</button>
					<button class="status" :style="msgData.status==2?'background:red':''"
						@click="jumpRectification(msgData.followflag,msgData.status)"
						v-if="msgData.status==1 || msgData.status==2">{{msgData.status==1?'审核中':msgData.status==2?'已驳回':''}}</button>
					<button class="status" v-if="msgData.status==0"
						@click="jumpRectification(msgData.followflag,msgData.status)">整改执行</button>
				</view>
				<!-- <view class="outlet">排放口名称：1#除臭装置排气筒</view>
				<view class="name">污染物名称：苯、甲苯、二甲苯，</view>
				<view class="content">监测内容：烟气流速，烟气温度，风</view> -->

				<!--yecw add start 20250430-->
				<!-- .wastename
				lstEnterpriseMonitorInfo[0].manualcollectmethod
				lstEnterpriseMonitorInfo[0].monitortimes
				lstEnterpriseMonitorInfo[0].manualtestmethod -->
				<!--yecw add end 20250430-->
				<view class="table-wrap" v-if="msgData.noticetype==1">
					<view class="title-wrap">
						<view class="type">污染源名称</view>
						<view class="type">手工监测采样方法及个数</view>
						<view class="type">手工监测频次</view>
						<view class="type">手工测定方法</view>
					</view>
					<view class="item" v-for="item in msgData.lstEnterpriseMonitorInfo" :key="item.id">
						<view class="type">{{item.wastename}}</view>
						<view class="type">{{item.manualcollectmethod}}</view>
						<view class="type">{{item.monitortimes}}</view>
						<view class="type">{{item.manualtestmethod}}</view>
					</view>
				</view>
			</view>


		</view>





	</view>
</template>

<script setup>
	import disposeContent from '../../utils/disposeContent'
	import titleName from '../../components/titleName.vue'
	import noData from '../../components/noDataShow.vue'
	import {
		resourceUrl
	} from '../../request/config'
	import http from '../../request/index.js'
	import {
		ref
	} from 'vue'
	import {
		onLoad
	} from "@dcloudio/uni-app"
	let name = "消息"
	let seltop = ref(1)
	let ids = ref('')
	let msgData = ref({})
	let title = ref('')
	let id = ref('')
	let noticeid = ref('')
	let jumpGuide = () => {

		uni.navigateTo({
			url: `/messagePageOther/licensingguidelines/index`
		})
	}
	onLoad((e) => {
		let id = e.id
		ids.value = e.id
		noticeid.value = e.noticeid
		http({
			url: "/greenMessage/detailv2",
			data: {
				id: e.id
			}
		}).then((res) => {
			if (res.code == 0) {
				msgData.value = res.data
			}
		})

	})
	let jumpOnlineMonitorContent = (subnoticetype) => {
		let type;

		if (subnoticetype == 21) {
			type = 2
		} else if (subnoticetype == 22) {
			type = 1
		} else {
			type = 3
		}
		uni.navigateTo({
			url: `/messagePageOther/onlinemonitorcontent/index?type=${type}`
		})
	}
	let jumpRectification = (followflag, status) => {
		let followattachurl = msgData.value.noticeFollow.followattachurl
		let followremark = msgData.value.noticeFollow.followremark
		// uni.redirectTo({
		// 	url: `/homePageOther/rectification/index?enterprise=${msgData.value.enterprisename}&content=${msgData.value.content}&noticeid=${msgData.value.noticeid}&id=${msgData.value.id}&followattachurl=${followattachurl}&followremark=${followremark}&status=${msgData.value.status}`
		// })
		// return

		/* 第一次提交 */
		if (status == 3) {
			uni.navigateTo({
				url: `/messagePageOther/enterprisecontrolexaminedetail/index?examineFlag=2&id=${ids.value}`
			})
		}
		if (status == 0 || status == 1) {
			uni.redirectTo({
				url: `/homePageOther/rectification/index?enterprise=${msgData.value.enterprisename}&content=${msgData.value.content}&noticeid=${msgData.value.noticeid}&id=${msgData.value.id}&followattachurl=${followattachurl}&followremark=${followremark}&status=${msgData.value.status}`
			})
			/* 驳回 */
		} else if (status == 2) {
			uni.redirectTo({
				url: `/messagePageOther/enterprisecontrolexaminedetail/index?examineFlag=2&id=${ids.value}`
			})
		}


	}
</script>

<style lang="scss" scoped>
	.message-detail {
		width: 100vw;
		height: 100vh;
		overflow: hidden;

		.wrap {
			width: 750rpx;
			height: calc(100vh - 160upx);
			background: #F3F5F7;
			padding-top: 22upx;
			overflow: scroll;

			.msg {
				margin-top: 15upx;
				padding: 60upx 55upx 93upx 54upx;
				background-color: #fff;
				white-space: pre-line;

				.type,
				.outlet,
				.name,
				.content {
					width: 100%;
					font-family: Microsoft YaHei;
					font-weight: 400;
					font-size: 31rpx;
					color: #333333;
					line-height: 65rpx;

				}

				.outlet {}

				.name {}

				.content {}
			}

			.table-wrap {
				border: 2upx solid #DADADA;
				margin-top: 23upx;

				.item {

					background-color: #fff !important;
					border-top: 2upx solid #DADADA;
					display: flex;

					.type {
						font-family: Microsoft YaHei;
						font-weight: 400;
						padding: 28upx 10upx !important;
						color: #333333;
						display: flex;
						align-items: center;
						height: auto;
						line-height: normal;
						text-align: center;
						justify-content: center;
						font-size: 21upx !important;
					}

					.type:nth-of-type(1),
					.type:nth-of-type(2),
					.type:nth-of-type(3) {
						border-right: 2upx solid #DADADA
					}

					.type:nth-of-type(4) {
						width: 207upx;flex-shrink: 0;
					}

					.type:nth-of-type(3) {
						width: 106upx;
						flex-shrink: 0;
						border-right: 2upx solid #DADADA
					}
				}

				.title-wrap {
					display: flex;

					flex-wrap: nowrap;
					width: 100%;
					height: 103upx;
					background: #F6F8F9;

					.type {

						font-family: Microsoft YaHei;
						font-weight: 400;
						font-size: 24rpx;
						color: #333333;
						display: flex;
						align-items: center;
						height: 103upx;
						line-height: normal;
						text-align: center;
						justify-content: center;
						padding: 28upx 10upx !important;
					}

					.type:nth-of-type(1),
					.type:nth-of-type(2),
					.type:nth-of-type(3) {
						border-right: 2upx solid #DADADA
					}

					.type:nth-of-type(3) {
						width: 106upx;
						flex-shrink: 0;
						border-right: 2upx solid #DADADA
					}
					.type:nth-of-type(4) {
						width: 207upx;flex-shrink: 0;
					}
				}
			}

			.status-wrap {
				padding-top: 200upx;

				.down {
					width: 649rpx;
					height: 87rpx;
					background: #FFFFFF;
					border-radius: 43rpx;
					border: 1px solid #A7A7A7;

					font-family: PingFang SC;
					font-weight: 500;
					font-size: 31rpx;
					color: #999999;
					line-height: 87rpx;
				}

				.status {
					width: 649rpx;
					height: 87rpx;
					background: #0874FA;
					border-radius: 43rpx;

					font-family: PingFang SC;
					font-weight: 500;
					font-size: 31rpx;
					color: #FFFFFF;
					line-height: 87rpx;
				}
			}

			.detail {


				text-align: left;
				line-height: 65rpx;
				font-family: Microsoft YaHei;
				font-weight: 400;
				font-size: 31rpx;
				color: #0874FA;

			}



			.title {
				height: 276upx;
				width: 100vw;
				color: #34363A;
				background-color: #fff;
				padding: 33upx 0 27upx 54upx;
				display: flex;
				flex-direction: column;
				// justify-content: space-between;

				.publisher {
					display: flex;
					align-items: center;


					image {
						width: 55upx;
						height: 55upx;
						margin-right: 10upx;
					}

					.content {
						.name {

							font-family: Source Han Sans CN;
							font-weight: 500;
							font-size: 24rpx;
							color: #070707;

						}

						.publish-time {
							display: flex;
							align-items: center;

							.publish {
								width: 48rpx;
								height: 23rpx;
								background: #EEF2FF;
								border-radius: 6rpx;
								line-height: 23upx;
								text-align: center;
								font-family: Source Han Sans CN;
								font-weight: 500;
								font-size: 14rpx;
								color: #0874FA;
								margin-right: 7upx;

							}

							.time {

								font-family: Source Han Sans CN;
								font-weight: 400;
								font-size: 22rpx;
								color: #999999;

							}
						}
					}
				}

			}

			.name {

				font-family: Microsoft YaHei;
				font-weight: 400;
				font-size: 42rpx;
				color: #34363A;

			}

			.time1 {

				font-family: Microsoft YaHei;
				font-weight: 400;
				font-size: 31rpx;
				color: #96989F;
				margin-top: 22upx;
				margin-bottom: 32upx;


			}
		}






	}
</style>